28 research outputs found

    Etude polarisée du système L

    Get PDF
    Herbelin coined the name ``System L'' to refer to syntactical quotients of sequent calculi, in which two classes of terms interact in commands, in the manner of Curien's and Herbelin's lambda-bar-mu-mu-tilde calculus or Wadler's dual calculus. This paper introduces a system L that has constructs for all connectives of second order linear logic, and that shifts focus from the old code/environment interaction to a game between positives and negatives. L provides quotients for major second order sequent calculi, in their right-hand-side-sequents formulation as well as their two-sided-sequents formulation, namely LL, LK and LLP. The logician reader will appreciate the unifying framework for the study of sequent calculi it claims to be, whereas the computer scientist reader will appreciate the fact that it is a step toward Herbelin's project of rebuilding a theory of computation that puts ``call by name'' and ``call by value'' on an equal footing --- in particular is L involved with respect to reduction strategies, to wit that a cut elimination protocol that enjoys the Curch-Rosser property seems to stand out, and it allows to mix lazy and eager aspects. The principal tool for the study of this system is classical realizability, a consequence being that this tool is now extended to call by value

    From delimited CPS to polarisation

    Get PDF
    Appeared in the author's PhD thesis (Chapter III) along with more details. See (and cite) Guillaume Munch-Maccagnoni, Syntax and Models of a non-Associative Composition of Programs and Proofs, Université Paris-Diderot - Paris VII, 2013, .The understanding of continuation-passing style (CPS) translations, an historical source of denotational semantics for programming languages, benefits from notions brought by linear logic, such as focalisation, polarities and the involutive negation. Here we aim to show how linear logic helps as well when continuations are delimited, i.e. return and can be composed, in the sense of Danvy and Filinski. First we provide a polarised calculus with delimited control (first-class delimited continuations) which is, at the level of computation, a variant of Girard's polarised classical logic LC. It contains variants of delimited control calculi which spawned as answers to the question "what order of evaluation can we consider with delimited control?". Thus our polarised calculus is one answer which is unifying to some degree. Subsequently we decompose the calculus through polarised linear logic. The only difference with non-delimited continuations is the use of specific exponentials, that account for the specific semantics of the target of delimited CPS translation, as well as annotations of type-and-effect systems. As a by-product, we obtain an explanation of CPS translations through a factoring, each step of which accounts for distinct phenomena of CPS translations. Although the factoring also holds for non-delimited CPS translations, it did not appear in its entirety before

    Resource Polymorphism

    Get PDF
    We present a resource-management model for ML-style programming languages, designed to be compatible with the OCaml philosophy and runtime model. This is a proposal to extend the OCaml language with destructors, move semantics, and resource polymorphism, to improve its safety, efficiency, interoperability, and expressiveness. It builds on the ownership-and-borrowing models of systems programming languages (Cyclone, C++11, Rust) and on linear types in functional programming (Linear Lisp, Clean, Alms). It continues a synthesis of resources from systems programming and resources in linear logic initiated by Baker.It is a combination of many known and some new ideas. On the novel side, it highlights the good mathematical structure of Stroustrup's “Resource acquisition is initialisation” (RAII) idiom for resource management based on destructors, a notion sometimes confused with finalizers, and builds on it a notion of resource polymorphism, inspired by polarisation in proof theory, that mixes C++'s RAII and a tracing garbage collector (GC). In particular, it proposes to identify the types of GCed values with types with trivial destructor: from this definition it deduces a model in which GC is the default allocation mode, and where GCed values can be used without restriction both in owning and borrowing contexts.The proposal targets a new spot in the design space, with an automatic and predictable resource-management model, at the same time based on lightweight and expressive language abstractions. It is backwards-compatible: current code is expected to run with the same performance, the new abstractions fully combine with the current ones, and it supports a resource-polymorphic extension of libraries. It does so with only a few additions to the runtime, and it integrates with the current GC implementation. It is also compatible with the upcoming multicore extension, and suggests that the Rust model for eliminating data-races applies.Interesting questions arise for a safe and practical type system, many of which have already been thoroughly investigated in the languages and prototypes Cyclone, Rust, and Alms

    Efficient “out of heap” pointers for multicore OCaml

    Get PDF
    International audienceThis paper reports an experiment with a large pages allocator for the OCaml runtime, with measured performance improvements. A large pages allocator (also known in the literature under other names: superpages, etc.) is a standard component of a memory allocator that stands between the OS and user-facing allocators (e.g. minor and major heaps) and which reserves and manages large chunks of contiguous memory. The OCaml runtime currently gives up a good amount of control by assigning this role to the system allocator. Other languages have a simple implementation from which practical lessons can be learnt (especially in terms of portability), such as the one from the Go runtime.Control over large pages affect (traditionally) the components implementing virtual address translation (hardware-level page table, TLB), in particular by leveraging (hardware-level) huge pages. It also enables (more specifically) efficient implementations of the OCaml page table, a data structure used in various parts of the OCaml runtime to classify pointers, to distinguish for instance which blocks belong to the heaps and which ones are “out-of-heap” during the marking phase of the GC.One goal was to evaluate the possible performance of a page table for multicore OCaml. While I did not use original techniques, some of the results are unexpected a priori based on expressed beliefs in the OCaml community.In essence, this paper reports the good hypothetical performance, in rigorous practical terms, of embedding (borrowing) linearly-allocated values inside garbage-collected values. A companion submission to the ML workshop reports a symmetrical result: how to efficiently embed (own) garbage-collected values inside linearly-allocated values. Taken together, the broader motivation is to show the feasibility of basing linear allocation with re-use (Lafont 1988; Baker 1992) in languages that would still leverage state-of-art garbage collection for non-linear values

    Probabilistic resource limits using StatMemprof

    Get PDF
    International audienceWe present Memprof-limits, a probabilistic implementation of per-thread global memory limits, and per-thread allocation limits, for OCaml 4.12.• Per-thread global memory limits let you limit the size the major heap can reach in specific parts of your program.• Per-thread allocation limits let you bound the execution of parts of the program measured in number of allocation, analogous to the same feature in Haskell. Allocation limits count allocations but not deallocations, and is therefore a measure of the work done which can be more suitable than execution time in addition to being more portable.The two main conceptual contributions are the following:1. we provide Memprof-limits with a statistical analysis that the user can rely on to get guarantees about the enforcement of limits.2. we provide Memprof-limits with a guide on how to recover from asynchronous exceptions and other unexpected exceptions, thereby summarising practical knowledge acquired in OCaml by the Coq proof assistant, and also acquired in other programming languages such as Isabelle/ML—to my knowledge written for the first time

    Probabilistic resource limits using StatMemprof

    Get PDF
    International audienceWe present Memprof-limits, a probabilistic implementation of per-thread global memory limits, and per-thread allocation limits, for OCaml 4.12.• Per-thread global memory limits let you limit the size the major heap can reach in specific parts of your program.• Per-thread allocation limits let you bound the execution of parts of the program measured in number of allocation, analogous to the same feature in Haskell. Allocation limits count allocations but not deallocations, and is therefore a measure of the work done which can be more suitable than execution time in addition to being more portable.The two main conceptual contributions are the following:1. we provide Memprof-limits with a statistical analysis that the user can rely on to get guarantees about the enforcement of limits.2. we provide Memprof-limits with a guide on how to recover from asynchronous exceptions and other unexpected exceptions, thereby summarising practical knowledge acquired in OCaml by the Coq proof assistant, and also acquired in other programming languages such as Isabelle/ML—to my knowledge written for the first time

    Etude polarisée du système L

    Get PDF
    Herbelin coined the name ``System L'' to refer to syntactical quotients of sequent calculi, in which two classes of terms interact in commands, in the manner of Curien's and Herbelin's lambda-bar-mu-mu-tilde calculus or Wadler's dual calculus. This paper introduces a system L that has constructs for all connectives of second order linear logic, and that shifts focus from the old code/environment interaction to a game between positives and negatives. L provides quotients for major second order sequent calculi, in their right-hand-side-sequents formulation as well as their two-sided-sequents formulation, namely LL, LK and LLP. The logician reader will appreciate the unifying framework for the study of sequent calculi it claims to be, whereas the computer scientist reader will appreciate the fact that it is a step toward Herbelin's project of rebuilding a theory of computation that puts ``call by name'' and ``call by value'' on an equal footing --- in particular is L involved with respect to reduction strategies, to wit that a cut elimination protocol that enjoys the Curch-Rosser property seems to stand out, and it allows to mix lazy and eager aspects. The principal tool for the study of this system is classical realizability, a consequence being that this tool is now extended to call by value

    Note on models of polarised intuitionistic logic

    Get PDF
    Following renewed interest in duploids arising from the exponential comonad of linear logic (the construction describing polarised intuitionistic translations into linear logic), I summarise here various remarks:• about a decomposition of Girard's "boring" translation as the expression of call-by-value in call-by-name, dual to how thunks are used to express call-by-name in call-by-value• about the coincidence between linear CPS translations and Girard's translations of intuitionistic logic into linear logic,• about a completeness property of historical models of linear logic in the above context• about a rational reconstruction of these translations with the Linear Call-by-Push-Value

    Towards better systems programming in OCaml with out-of-heap allocation

    Get PDF
    International audienceThe current multicore OCaml implementation bans so-called "naked pointers", pointers to outside the OCaml heap unless they follow drastic restrictions. A backwards-incompatible change has been proposed to make way for the new multicore GC in OCaml. I argue that out-of-heap pointers are not an anomaly, but are part of a better systems programming future
    corecore